package com.xingkeduo.model.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.xingkeduo.model.bo.AttendanceWorkStatusEnum;
import com.xingkeduo.model.po.TStaffAttendance;

import java.text.SimpleDateFormat;

/**
 * @Description TODO
 * @Date 2019/3/21 11:47
 * @Created 情绪十分不稳定的Shadow
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class StaffAttendanceVo {

    private Integer id;
    private String staffName;
    private String managerName;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long staffId;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long storeId;
    private String storeName;
    private Byte type;
    private String date;
    private String startTime;
    private String endTime;
    private String realWorkStartTime;
    private String realWorkStopTime;
    private String workStatus;
    private Boolean status;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long staffCode;

    public StaffAttendanceVo(TStaffAttendance tStaffAttendance, Long code) {
        SimpleDateFormat dateDf = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat timeDf = new SimpleDateFormat("HH:mm");
        Byte type = tStaffAttendance.getType();
        this.id = tStaffAttendance.getId();
        this.staffCode = code;
        this.staffName = tStaffAttendance.getStaffName();
        this.managerName = tStaffAttendance.getManagerName();
        this.staffId = tStaffAttendance.getStaffId();
        this.storeId = tStaffAttendance.getStoreId();
        this.storeName = tStaffAttendance.getStoreName();
        if(tStaffAttendance.getType() != null){
            this.type = tStaffAttendance.getType();
        }
        this.date = dateDf.format(tStaffAttendance.getDate());
        if(tStaffAttendance.getStartTime() != null && null != type){
            if(type == 1 || type == 2 || type == 3 || type == 8){
                this.startTime = timeDf.format(tStaffAttendance.getStartTime());
            }
        }else{
            this.startTime = "";
        }
        if(tStaffAttendance.getEndTime() != null && null != type){
            if(type == 1 || type == 2 || type == 3 || type == 8){
                this.endTime = timeDf.format(tStaffAttendance.getEndTime());
            }
        }else {
            this.endTime = "";
        }
        if(tStaffAttendance.getRealWorkStartTime() != null){
            this.realWorkStartTime = timeDf.format(tStaffAttendance.getRealWorkStartTime());
        }else{
            this.realWorkStartTime = "";
        }
        if(tStaffAttendance.getRealWorkStopTime() != null){
            this.realWorkStopTime = timeDf.format(tStaffAttendance.getRealWorkStopTime());
        }else{
            this.realWorkStopTime = "";
        }
        if(tStaffAttendance.getWorkStatus() != null){
            this.workStatus = String.valueOf(AttendanceWorkStatusEnum.getAttendanceWorkStatus(tStaffAttendance.getWorkStatus()).getValue());
        }
        this.status = tStaffAttendance.getStatus();
    }

    public String getStaffName() {
        return staffName;
    }

    public void setStaffName(String staffName) {
        this.staffName = staffName;
    }

    public Byte getType() {
        return type;
    }

    public void setType(Byte type) {
        this.type = type;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public String getRealWorkStartTime() {
        return realWorkStartTime;
    }

    public void setRealWorkStartTime(String realWorkStartTime) {
        this.realWorkStartTime = realWorkStartTime;
    }

    public String getRealWorkStopTime() {
        return realWorkStopTime;
    }

    public void setRealWorkStopTime(String realWorkStopTime) {
        this.realWorkStopTime = realWorkStopTime;
    }

    public String getWorkStatus() {
        return workStatus;
    }

    public void setWorkStatus(String workStatus) {
        this.workStatus = workStatus;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Long getStaffId() {
        return staffId;
    }

    public void setStaffId(Long staffId) {
        this.staffId = staffId;
    }

    public Boolean getStatus() {
        return status;
    }

    public void setStatus(Boolean status) {
        this.status = status;
    }

    public Long getStoreId() {
        return storeId;
    }

    public void setStoreId(Long storeId) {
        this.storeId = storeId;
    }

    public String getStoreName() {
        return storeName;
    }

    public void setStoreName(String storeName) {
        this.storeName = storeName;
    }

    public Long getStaffCode() {
        return staffCode;
    }

    public void setStaffCode(Long staffCode) {
        this.staffCode = staffCode;
    }

    public String getManagerName() {
        return managerName;
    }

    public void setManagerName(String managerName) {
        this.managerName = managerName;
    }
}
